﻿using System.Data.Entity.ModelConfiguration;
using System.ComponentModel.DataAnnotations;

using Whoever.Health.Business.Entities;

namespace Whoever.Health.DataAccess.Configuration
{
    internal class AuditLogConfiguration : EntityTypeConfiguration<AuditLog>
    {
        public AuditLogConfiguration()
        {
            HasKey(e => e.Id);

            Property(e => e.Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            Property(e => e.Entity)
                .HasMaxLength(30)
                .IsUnicode(false);

            Property(e => e.TypeOfCRUD)
                .HasMaxLength(1)
                .IsUnicode(false);

            Property(e => e.UserId);

            Property(e => e.ChangeDateTime);

            Property(e => e.OldState)
                .IsUnicode(false);

            Property(e => e.NewState)
                .IsUnicode(false);
        }
    }
}
